import { request } from '@/utils/request';
// import * as unit from '@/common/shared/format';
import { dataList } from './data/demo';

/** 查询 */
export async function query(params) {
  return request('{{base}}/success.json', {
    fakeApi: dataList.query.bind(dataList),
    params,
    reqType: 'table',
    // formatOut: [unit.split('scope')],
  });
}

/** 新增 */
export async function create(data) {
  return request('{{base}}/success.json', {
    fakeApi: dataList.create.bind(dataList),
    method: 'POST',
    data,
    reqType: 'command',
    // formatIn: [unit.join('scope')],
  });
}

/** 更新 */
export async function update(data) {
  return request('{{base}}/success.json', {
    fakeApi: dataList.update.bind(dataList),
    method: 'POST',
    data,
    reqType: 'command',
    // formatIn: [unit.join('scope')],
  });
}

/** 删除 */
export async function remove(data) {
  return request('{{base}}/success.json', {
    fakeApi: dataList.remove.bind(dataList),
    method: 'POST',
    data,
    reqType: 'command',
    // formatIn: [unit.keep('id')],
  });
}
